package cn.com.startai.smartadh5.main.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import butterknife.BindView;
import butterknife.ButterKnife;
import cn.com.startai.smartadh5.R;

/**
 * Created by Taro on 2017/3/28.
 * File 查看器
 */
public class FileFragment extends BaseFragment{

    @BindView(R.id.one)
    View one ;
    @BindView(R.id.two)
    View two ;
    @BindView(R.id.three)
    View three ;
    @BindView(R.id.four)
    View four ;

    private int current = 1 ;

    @Override
    protected View inflaterView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_file, container, false);
    }


    @Override
    public void initData() {

    }

    @Override
    public void initView() {
        changeView();
    }

    @Override
    public void addViewListener() {

    }

    private void changeView(){
        one.setBackgroundColor(0xFFFFFFFF);
        two.setBackgroundColor(0xFFFFFFFF);
        three.setBackgroundColor(0xFFFFFFFF);
        four.setBackgroundColor(0xFFFFFFFF);
        switch (current) {
            case 1 :
                one.setBackgroundColor(0xFF0080FF);
                break;
            case 2 :
                two.setBackgroundColor(0xFF0080FF);
                break;
            case 3 :
                three.setBackgroundColor(0xFF0080FF);
                break;
            case 4 :
                four.setBackgroundColor(0xFF0080FF);
                break;

        }
    }

    @Override
    public void onLeftPress() {
        super.onLeftPress();
        if (current > 1) {
            current -- ;
            changeView();
        }
    }

    @Override
    public void onRightPress() {
        super.onRightPress();
        if (current < 4) {
            current ++ ;
            changeView();
        }
    }
}
